package com.yanqu.road.entity.activity.fivehero.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_s_activity_five_hero_type")
public class FiveHeroTypeConfig {

    @FieldTypeAnnotation(desc = "活动ID", select = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "城池类型")
    private int type;
    @FieldTypeAnnotation(desc = "城池图标")
    private int icon;
    @FieldTypeAnnotation(desc = "城池类型名称")
    private String name;
    @FieldTypeAnnotation(desc = "阵营点/分")
    private int campPoint;
    @FieldTypeAnnotation(desc = "阵营积分")
    private int campScore;
    @FieldTypeAnnotation(desc = "守军队伍数量")
    private int teamNum;
    @FieldTypeAnnotation(desc = "PVP守军生成规则：各个抽取池抽取权重")
    private String pvpTeamDrawWeights;
    @FieldTypeAnnotation(desc = "PVE守军生成规则：各个抽取池抽取权重")
    private String pveTeamDrawWeights;
    @FieldTypeAnnotation(desc = "防守加成(千分比)")
    private int addition;
    @FieldTypeAnnotation(desc = "体力消耗")
    private int energyCost;
    @FieldTypeAnnotation(desc = "事件列表（事件id;事件权重）")
    private String eventList;
    @FieldTypeAnnotation(desc = "PVP守军战斗规则：难度池出战顺序（1表示最强池子）如果消灭了第一轮守军，再按难度池从强到弱的顺序把所有难度池里的守军随机打完。")
    private String diffPoolFightOrder;
    @FieldTypeAnnotation(desc = "占有度")
    private String blood;

    //事件，权重
    private Map<Integer,Integer> eventMap; //事件的随机参数
    //千分比人数
    private List<Integer> pvpUserPerList = new ArrayList<>();
    private List<Integer> pvpPatronsWeightList = new ArrayList<>();
    //千分比人数
    private List<Integer> pveUserPerList = new ArrayList<>();
    private List<Integer> pvePatronsWeightList = new ArrayList<>();

    private List<Integer> poolSelectList = new ArrayList<>();

    //占有度初始值和最大值
    private List<Integer> bloodList = new ArrayList<>();


    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getIcon() {
        return icon;
    }

    public void setIcon(int icon) {
        this.icon = icon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCampPoint() {
        return campPoint;
    }

    public void setCampPoint(int campPoint) {
        this.campPoint = campPoint;
    }

    public int getCampScore() {
        return campScore;
    }

    public void setCampScore(int campScore) {
        this.campScore = campScore;
    }

    public int getTeamNum() {
        return teamNum;
    }

    public void setTeamNum(int teamNum) {
        this.teamNum = teamNum;
    }

    public String getPvpTeamDrawWeights() {
        return pvpTeamDrawWeights;
    }

    public void setPvpTeamDrawWeights(String pvpTeamDrawWeights) {
        this.pvpTeamDrawWeights = pvpTeamDrawWeights;
        if(StringUtils.isNullOrEmpty(pvpTeamDrawWeights) || "0".equals(pvpTeamDrawWeights)){
            return;
        }
        List<String> abcList = StringUtils.stringToStringList(pvpTeamDrawWeights,"\\|");
        for(String gaga : abcList){
            List<Integer> gagaList = StringUtils.stringToIntegerList(gaga,"=");
            pvpUserPerList.add(gagaList.get(0));
            pvpPatronsWeightList.add(gagaList.get(1));
        }
    }

    public String getPveTeamDrawWeights() {
        return pveTeamDrawWeights;
    }

    public void setPveTeamDrawWeights(String pveTeamDrawWeights) {
        this.pveTeamDrawWeights = pveTeamDrawWeights;
        if(StringUtils.isNullOrEmpty(pveTeamDrawWeights) || "0".equals(pveTeamDrawWeights)){
            return;
        }
        List<String> abcList = StringUtils.stringToStringList(pveTeamDrawWeights,"\\|");
        for(String gaga : abcList){
            List<Integer> gagaList = StringUtils.stringToIntegerList(gaga,"=");
            pveUserPerList.add(gagaList.get(0));
            pvePatronsWeightList.add(gagaList.get(1));
        }
    }

    public int getAddition() {
        return addition;
    }

    public void setAddition(int addition) {
        this.addition = addition;
    }

    public int getEnergyCost() {
        return energyCost;
    }

    public void setEnergyCost(int energyCost) {
        this.energyCost = energyCost;
    }

    public String getEventList() {
        return eventList;
    }

    public void setEventList(String eventList) {
        this.eventList = eventList;
        if("0".equals(eventList)){
            eventMap = new ConcurrentHashMap<>();
            return;
        }
        eventMap = new ConcurrentHashMap<>();
        List<String> tempStrList = StringUtils.stringToStringList(this.eventList,"\\|");
        for(String tempStr : tempStrList){
            List<Integer> tempIntList = StringUtils.stringToIntegerList(tempStr,";");
            eventMap.put(tempIntList.get(0),tempIntList.get(1));
        }
    }


    public Map<Integer, Integer> getEventMap() {
        return eventMap;
    }

    public List<Integer> getPvpPatronsWeightList() {
        return pvpPatronsWeightList;
    }

    public List<Integer> getPvePatronsWeightList() {
        return pvePatronsWeightList;
    }

    public List<Integer> getPvpUserPerList() {
        return pvpUserPerList;
    }

    public List<Integer> getPveUserPerList() {
        return pveUserPerList;
    }

    public String getDiffPoolFightOrder() {
        return diffPoolFightOrder;
    }

    public void setDiffPoolFightOrder(String diffPoolFightOrder) {
        this.diffPoolFightOrder = diffPoolFightOrder;
        if(StringUtils.isNullOrEmpty(diffPoolFightOrder) || "0".equals(diffPoolFightOrder)){
            return;
        }
        poolSelectList = StringUtils.stringToIntegerList(this.diffPoolFightOrder,"\\|");
    }

    public List<Integer> getPoolSelectList() {
        return poolSelectList;
    }

    public String getBlood() {
        return blood;
    }

    public void setBlood(String blood) {
        if(StringUtils.isNullOrEmpty(blood)){
            switch (type){
                case 1:blood = "1500|99999";break;
                case 2:blood = "3000|99999";break;
                case 3:blood = "4500|99999";break;
                case 4:blood = "0|99999";break;
                case 5:blood = "0|99999";break;
            }
        }
        this.blood = blood;
        bloodList = StringUtils.stringToIntegerList(blood,"\\|");
    }

    public List<Integer> getBloodList() {
        return bloodList;
    }
}
